<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>分配角色权限</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link href="${ctx }/css/style.css" type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="${ctx }/js/jquery/jquery-1.6.1.min.js"></script>
		<script type="text/javascript">
			$(function() {
				$("#btnBack").click(function() {
					parent.window.frames[0].location = "${ctx}/role/listRoles.action";
				});

				$("#btnSave").click(function() {
					var selected = [];
					var unSelected = [];
					
					$("input[name=ids]:checked").each(function() {
						selected.push($(this).val());
					});

					$("input[name=ids]:not(:checked)").each(function() {
						unSelected.push($(this).val());
					});

					$("#selIds").val(selected);
					$("#unSelIds").val(unSelected);

					$("form:first").submit();
				});
			});
		</script>
	</head>
	<body>
		<s:form action="distributeRole" method="post" namespace="/role">
			<div>
				<div style="width: 99%; height: 30px; text-align: left;">
					当前位置：分配角色权限
				</div>
				<div
					style="float: left; width: 99%; background-color: #EDDEA0; height: 30px;">
					<b>分配角色权限</b>
				</div>
				<div style="width: 100%; background-color: #FBF7E6">
					&nbsp;权限分配
					<font color="red">
						(选定后保存)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</font>
					<strong>当前角色-&gt;</strong>
					<span style="color: blue; width: 125px;">
						<s:property value="role.roleName" />
					</span>
				</div>
				<div style="width: 100%; background-color: #FBF7E6; text-align: left">
					<table cellspacing="5" cellpadding="10" border="0" style="border-style:none;">
						<tr>
							<s:iterator value="funList" var="fun" status="serial">
								<td>
									<s:if test="%{#serial.index != 0 && #serial.index % 4 == 0}">
										<tr></tr><td> 
									</s:if>
									<input type="checkbox" name="ids" value='<s:property value="id" />' <s:if test="%{roleSysFunIds.contains(#fun.id)}">checked="checked"</s:if> alt="" />
									<label style="font-size: 13px;">
										<s:property value="displayName" />
									</label>
								</td>
							</s:iterator>
						</tr>
					</table>
				</div>
				<br />
				<br />
				<div>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="btnSave" type="button" value="提交" class="botton" style="width: 74px; cursor: hand;" />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="btnBack" type="button" value="返回" class="botton" style="width: 74px; cursor: hand;" />
				</div>
			</div>
			<s:hidden name="role.id"></s:hidden>
			<s:hidden id="selIds" name="selectedIds"></s:hidden>
			<s:hidden id="unSelIds" name="unSelectedIds"></s:hidden>
		</s:form>
	</body>
</html>
